﻿<UserControl x:Class="EyeOpen.Crypt.Silverlight.BusyIndicator"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:Silverlight="clr-namespace:EyeOpen.Crypt.Silverlight"
    xmlns:ControlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit">
    <UserControl.Resources>
        <Style
            x:Key="Container"
            TargetType="ControlsToolkit:HeaderedContentControl">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate
                            TargetType="ControlsToolkit:HeaderedContentControl">
                        <Grid>
                            <ContentControl
                                    Content="{TemplateBinding Header}"
                                    FontWeight="Bold"
                                    HorizontalAlignment="Center"
                                    Margin="4"/>
                            <Border
                                    BorderBrush="Gray"
                                    BorderThickness="1">
                                <ContentPresenter
                                        Content="{TemplateBinding Content}"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style
            x:Key="Content" 
            TargetType="ContentControl">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ContentControl">
                        <Silverlight:Encryption/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <StackPanel
        DataContext="{Binding Path=CryptViewModel, Source={StaticResource viewModelLocator}}">
        <ControlsToolkit:HeaderedContentControl
            Style="{StaticResource Container}">
            <ControlsToolkit:BusyIndicator
                IsBusy="{Binding IsBusy}"
                BusyContent="Encrypting/Decrypting"
                DisplayAfter="0">
                <ContentControl Style="{StaticResource Content}"/>
            </ControlsToolkit:BusyIndicator>
        </ControlsToolkit:HeaderedContentControl>
    </StackPanel>
</UserControl>